import mongoose from "mongoose";

const HornySchema = new mongoose.Schema(
  {
    userId: { type: mongoose.Schema.Types.ObjectId, required: true },
    day: { type: Number, required: true, index: 1 },
    hornySize: { type: Number, required: true },
    emoji: { type: String, required: true },
    createdAt: { type: Date },
    updatedAt: { type: Date },
  },
  {
    timestamps: { createdAt: true, updatedAt: true, currentTime: () => new Date() },
    virtuals: {
      user: {
        options: {
          ref: "User",
          localField: "userId",
          foreignField: "_id",
          justOne: true,
        },
      },
    },
  },
);

export const Horny = mongoose.model("Horny", HornySchema);
